/**
 * 2025/01/01 - 2025/12/31
 */
package com.snail.starter.db.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.snail.starter.db.annotation.mapstruct.ToYesOrNo;
import lombok.Getter;
import lombok.ToString;

/**
 * @author zgadmin
 * @date 2025/7/1 16:31
 */
@Getter
@ToString
public enum YesOrNoEnum implements IEnum<Integer>{

    YES(0, "是"),
    NO(1, "否"),
    ;

    private final Integer value;

    private final String desc;

    YesOrNoEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public boolean getBoolean() {
        return 0 == value;
    }

    @ToYesOrNo
    public static YesOrNoEnum getEnum(boolean value) {
        return value ? YES : NO;
    }

}